<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 's_modify.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

 <script language="javascript">
           function UserDel(userId)
           {
               if(confirm('您确定删除吗？'))
               {	
              
                   window.location.href="<%=path %>/servlet/DeleteInfo?userId="+userId;
               }
           }
           
           	function check1(){
				if( document.getElementById("userName").value==""){
					alert("请输入用户名");
					return false;
				}
					document.formUpdata.submit();
			}
           
 </script>
        
	</head>

<body leftmargin="2" topmargin="2" >
	<table>
			<form action="servlet/FindInfoByName" name="formUpdata" method="post">
				<tr>
				用户查询
				</tr>
				<tr>
					 <td width="25%" bgcolor="#FFFFFF" align="right">  请输入用户名：</td>
				    <td width="75%" bgcolor="#FFFFFF" align="left">
				        <input type="text" name="username" size="20"/>
				        <input type="submit" value="提交" onClick="check1()"/>&nbsp;
				    </td>
				</tr>
				</form>
				</table>
				<h1>${message}</h1>
			<table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D1DDAA" align="center" style="margin-top:8px">
				<tr bgcolor="#E7E7E7">
					<td height="14" colspan="6" align='center'>&nbsp;管理员维护&nbsp;</td>
				</tr>
				<tr align="center" bgcolor="#FAFAF1" height="22">
					<td width="18%">ID</td>
					<td width="18%">用户名</td>
					<td width="18%">密码</td>
					<td width="18%">邮箱</td>
					<td width="18%">所在班级</td>
					<td width="10%">操作</td>
		        </tr>	
				<c:forEach items="${user}" var="s">
				<tr align='center' bgcolor="#FFFFFF" height="22">
					<td bgcolor="#FFFFFF" align="center">
						${s.s_id}
					</td>
					<td bgcolor="#FFFFFF" align="center">
						${s.username}
					</td>
					<td bgcolor="#FFFFFF" align="center">
					    ${s.password}
					</td>
					<td bgcolor="#FFFFFF" align="center">
					   ${s.email}
					</td>
					<td bgcolor="#FFFFFF" align="center">
					    ${s.classes}
					</td>
					<td bgcolor="#FFFFFF" align="center">
						<a href="#" onclick="UserDel(${s.s_id})" >删除</a>
						<a href="<%=path %>/servlet/UpdateUser?id=${s.s_id}">修改</a>
					</td>
				</tr>
				</c:forEach>
			</table>
  </body>
</html>
